﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace iNet.Media.Imaging.Filters
{
	/// <summary>
	/// 色彩反轉點陣圖濾鏡。
	/// </summary>
	public class ColorInversionFilterTask : SimpleColorTransformFilterTask
	{
		#region 靜態欄位
		static readonly int[] _ColorTransformTable8 = new int[256];
		#endregion
		#region 型別建構子
		static ColorInversionFilterTask()
		{
			for (int i = 255; i >= 0; --i)
				_ColorTransformTable8[i] = (255 - i);
		}
		#endregion
		#region 建構子
		/// <summary>
		/// 初始化新的 ColorInversionFilterTask 執行個體。
		/// </summary>
		public ColorInversionFilterTask()
		{
			this.RedColorTransformTable = _ColorTransformTable8;
			this.GreenColorTransformTable = _ColorTransformTable8;
			this.BlueColorTransformTable = _ColorTransformTable8;
		}
		/// <summary>
		/// 初始化新的 ColorInversionFilterTask 執行個體。
		/// </summary>
		/// <param name="sourceBitmap">來源點陣圖。</param>
		public ColorInversionFilterTask(IBitmapImage sourceBitmap)
			: base(sourceBitmap)
		{
			this.RedColorTransformTable = _ColorTransformTable8;
			this.GreenColorTransformTable = _ColorTransformTable8;
			this.BlueColorTransformTable = _ColorTransformTable8;
		}
		#endregion
	}
}
